<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<html>
<head>
	<script src="${contextPath}/scripts/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
	<script src="${contextPath}/scripts/common.js" type="text/javascript"></script>
	<script src="${contextPath}/scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
	<%-- <script src="${contextPath}/scripts/loading.js" type="text/javascript"></script> --%>
	<link href="${contextPath}/styles/default.css" rel="stylesheet" type="text/css" />
<title>发票申请管理</title>
<script type="text/javascript">
	function jumpPage(page) {
		var searchForm = document.searchForm;
		searchForm.action = "<s:property value='contextPath'/>/mf/apply/index.do?currentPage=" + page;
		searchForm.submit();
	}

	function addByShop() {
		
		if(confirm("此操作将会生成所有店的应收管理费,是否继续 ?")){
			var searchForm = document.searchForm;
			searchForm.action = "<s:property value='contextPath'/>/mf/apply/add.do?currentPage=${currentPage}";
			showLoading();
			searchForm.submit();
			
		}
		
	}
	function openSubmint(id){
		var searchForm = document.searchForm;
		searchForm.action = "billSubmit.do?currentPage=${currentPage}&applyId="+id;
		searchForm.submit();
	}
	function addFinancial() {
		if(confirm("此操作将会生成所有店的应收管理费,是否继续 ?")){
			var searchForm = document.searchForm;
			searchForm.action = "<s:property value='contextPath'/>/mf/apply/addFinancial.do?currentPage=${currentPage}";
			showLoading();
			searchForm.submit();
		}
		
	}
	
	function editData(id) {
		var searchForm = document.searchForm;
		searchForm.action = "<s:property value='contextPath'/>/mf/apply/edit.do?currentPage=${currentPage}&id="+id;
		searchForm.submit();
	}
	function view(id) {
		var searchForm = document.searchForm;
		searchForm.action = "<s:property value='contextPath'/>/mf/apply/view.do?currentPage=${currentPage}&id="+id;
		searchForm.submit();
	}
	function viewFinad(id) {
		var searchForm = document.searchForm;
		searchForm.action = "<s:property value='contextPath'/>/mf/apply/viewFinad.do?currentPage=${currentPage}&id="+id;
		searchForm.submit();
	}
	function delData(id) {
		if(confirm("删除数据不可恢复,确认吗?")){
			var searchForm = document.searchForm;
			searchForm.action = "<s:property value='contextPath'/>/mf/apply/delete.do?currentPage=${currentPage}&id="+id;
			searchForm.submit();
		}
	}
	function editFinancial(id) {
		var searchForm = document.searchForm;
		searchForm.action = "<s:property value='contextPath'/>/mf/apply/editFinancial.do?currentPage=${currentPage}&entity.id="+id;
		searchForm.submit();
	}
	
	function deleteData(id) {
		if(confirm("确认要删除吗?")) {
			var searchForm = document.searchForm;
			searchForm.action = "<s:property value='contextPath'/>/system/menu/destory.do?currentPage=${currentPage}&entity.id="+id;
			searchForm.submit();
		}	  
	}
	
	function showLoading(){
		var height = window.screen.height-250;   
		 var width = window.screen.width;   
		 var leftW = 300;   
		 if(width>1200){   
		    leftW = 500;   
		 }else if(width>1000){   
		    leftW = 350;   
		 }else { 
		    leftW = 100;   
		 } 
		 $("#loading").css("height",height);
         $("#loading2").css("left",leftW);
         $("#loading").show();
	}
	$(document).ready(function () {
		$("#loading").hide();
	});
</script>
</head>
<body>
<div class="navigation">
  <span>
  <a href="javascript:window.history.forward();"><img src="${contextPath}/images/go_nav_btn.png" /></a>
   <a href="javascript:window.history.forward();">前进</a>
  <a href="javascript:window.location.reload();"><img src="${contextPath}/images/refresh_nav_btn.png" /></a>
   <a href="javascript:window.location.reload();">刷新</a>
  </span>管理费&gt;&gt;发票申请
</div>

<div id="loading" style="display:none;position:absolute;left:0;width:100%;height:800px;top:0;background:#E0ECFF;opacity:0.8;filter:alpha(opacity=80);">
	<div id="loading2" style="position:absolute;  cursor1:wait;left:350px;top:200px;width:auto;height:16px;padding:8px 5px 10px 30px;background:#fff url(${contextPath}/images/ajax-loading.gif) no-repeat scroll 5px 10px;border:2px solid #ccc;color:#000;">  
		正在生成数据，请耐心等待 . . .   
	</div>
</div>

<div class="xt_main_right_center">    
<form name="searchForm" id="searchForm" method="post" action="index.do">
	      <table width="100%" border="0" cellpadding="0" cellspacing="0"  style="border-color:#CCCCCC;">
	         <tr>
	        	<td class="left-td-width-bg"><span>申请人:</span> </td>
	        	<td>
	           		<input type="text" name='search.applyUser.realName'  class="input" value="<s:property value="search.applyUser.realName"/>"  style='width:120px'/>
	            </td>
	            <td class="left-td-width-bg"><span>申请时间:</span></td>
	            <td>
	            	<input name="search.createdAt" id="applyDateBegin"  class="Wdate" type="text" style="width: 100px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="true" value="<s:date name="search.createdAt" format="yyyy-MM-dd"/>"  onblur="checkdate(document.getElementById('applyDateEnd'),this)"/>
	            	至 <input name="search.updatedAt" id="applyDateEnd"  class="Wdate" type="text" style="width: 100px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="true" value="<s:date name="search.updatedAt" format="yyyy-MM-dd"/>" onblur="checkdate(document.getElementById('applyDateBegin'),this)"/>
	            </td>
	        </tr>
	         <tr>
	            <td colspan="4" align="right" style="padding-right: 120px">
	            	&nbsp;&nbsp;<input type="button" class="btn_clear_form" onclick="clearForm(this.form);return false;"/>
	            	&nbsp;&nbsp;<input id='sousuo' type="submit" value=""  class="btn_query"/>
	            </td>
	        </tr>
	      </table>
      </form>
</div> 
<br/>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td height="25" align="left"><font color="#0066CC"><strong>发票申请列表：</strong></font></td>
	    <td height="25" align="right">
	    <jysz:permission code="MF_APPLY_ADD_SHOP">
	    	<a href="javascript:addByShop()">发票申请(店)</a>&nbsp;&nbsp;&nbsp;&nbsp;
	    </jysz:permission>
	    <jysz:permission code="MF_APPLY_ADD_FIN">
	    	<a href="javascript:addFinancial()">发票申请(金融机构)</a>
	    </jysz:permission>
	  	</td>
	</tr>
</table> 
      
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
  <tr> 
	    <td width="4%" class="top-td-width-bg">序号</td>
	    <td width="8%" class="top-td-width-bg">申请批次号</td>
	    <td width="9%" class="top-td-width-bg">申请人</td>
	    <td width="9%" class="top-td-width-bg">申请时间</td>
	    <td width="8%" class="top-td-width-bg">申请总额</td>
	    <td width="8%" class="top-td-width-bg">状态</td>
	    <td width="8%" class="top-td-width-bg">操作</td>
	</tr>
 	<s:iterator value="page.result" status="st">
		<tr>
			<td  class="down-center-td-width-bg">
				<s:property value="#st.index+1"/>
			</td>
			<td  class="down-center-td-width-bg"><s:property value="applyNum" /></td>
			<td  class="down-center-td-width-bg"><s:property value="applyUser.realName" /></td>
			<td  class="down-center-td-width-bg"><s:property value="applyDate" /></td>
			<td  class="down-center-td-width-bg"><s:property value="formatAmount(getSumAmount(id))" /></td>
			<td  class="down-center-td-width-bg"><s:property value="status.name" /></td>
			<td  class="down-center-td-width-bg">
				<s:if test="@com.jysz.certificate.persistence.enums.mf.BillStatus@TEMPSAVE.equals(status)&&shopFlag">
				<jysz:permission code="MF_APPLY_ADD_SHOP">
					<a href="javascript:editData(<s:property value="id"/>);" title="编辑"><img src="${contextPath}/images/edit.gif" alt="编辑" width="16" height="13" border="0" /></a>&nbsp;
					<a href="javascript:delData(<s:property value="id"/>);" title="删除"><img src="${contextPath}/images/del.gif" alt="删除" width="16" height="13" border="0" /></a>&nbsp;
				</jysz:permission>
				</s:if>
				<s:if test="@com.jysz.certificate.persistence.enums.mf.BillStatus@TEMPSAVE.equals(status)&&!shopFlag">
					<a href="javascript:editFinancial(<s:property value="id"/>);"  title="编辑"><img src="${contextPath}/images/edit.gif" alt="编辑" width="16" height="13" border="0" /></a>&nbsp;
					<a href="javascript:delData(<s:property value="id"/>);" title="删除"><img src="${contextPath}/images/del.gif" alt="删除" width="16" height="13" border="0" /></a>&nbsp;
				</s:if>
				
				<s:if test="!@com.jysz.certificate.persistence.enums.mf.BillStatus@TEMPSAVE.equals(status)">
					<s:if test="shopFlag">
						<a href="javascript:view(<s:property value='id' />);" title="详情"><img src="${contextPath}/images/chakan.gif" alt="详情" width="16" height="18" border="0" /></a>&nbsp;
					</s:if>
					<s:else>
						<a href="javascript:viewFinad(<s:property value='id' />);" title="金融机构详情"><img src="${contextPath}/images/chakan.gif" alt="金融机构详情" width="16" height="18" border="0" /></a>&nbsp;
					</s:else>
				</s:if>
				<%-- <s:if test="@com.jysz.certificate.persistence.enums.mf.BillStatus@TEMPSAVE.equals(status)">
					<a href="javascript:openSubmint(<s:property value='id' />);">申请开票</a>&nbsp;
				</s:if> --%>
			</td>
		</tr>
	</s:iterator>
	<tr> 
	 <td height="36" colspan="7" class="down-center-td-width-bg" align="right">
			<%@ include file="/WEB-INF/view/common/pagination.jsp"%>
 		</td>
	</tr>
</table>


	<br/><br/><br/><br/><br/>
	<div align="center"><jsp:include page="/include/footer.inc"></jsp:include></div>
</body>
</html>